
# 1. 大小写转换
str = "liNuX"

print(str.capitalize())
print(str.upper())
print(str.lower())

# 2.判断字符串的开头结尾
print(str.endswith("cd"))
print(str.startswith("li"))

# 3.去除字符串两侧空白
str2 = "  linux   "
print(str2.strip())
print(str2.lstrip())
print(str2.rsplit())

# 4.Y/N
result = input("Y/N:").lower()
if "y" in result:
    print("执行")
else:
    print("取消")

# 5.字符串替换
# replace(old,new,count),旧的，新的，替换次数
str4 = "linux"
print(str4.replace("i","o"))

# 6.分割字符串
str3 = "docker   k8s   rancher"
# 分割出来是列表
print(str3.split())
# 取出来是字符
print(str3.split()[1])

ip = "10.11.0.254"
print(ip.split(".")[-1])

# 字符串的组成
# 判断是否全小写，全大写，全为数字
print("abd".islower())
print("ads".isupper())
print("123".isdigit())

